package usersimulation;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import usersimulation.sim1.IEvent;

public class Event implements IEvent{

	protected Object target;
	protected String name;
	protected Map<String, Object> params;
	
	public Event(String name)
	{
	    this.name = name;
	}
	
	public Event(String name, Object source)
	{
	    this.target = source;
	    this.name = name;
	}
	
	@Override
	public Object getTarget() {
		// TODO Auto-generated method stub
		return this.target;
	}

	@Override
	public void setTarget(Object target) {
		// TODO Auto-generated method stub
		this.target = target;
	}

	@Override
	public String getName() {
		// TODO Auto-generated method stub
		return this.name;
	}

	@Override
	public void setName(String name) {
		// TODO Auto-generated method stub
		this.name = name;
	}

	@Override
	public Object getParameter(String key) {
		// TODO Auto-generated method stub
		Object param = null;
	    if (this.params != null) {
	      param = this.params.get(key);
	    }
	    return param;
	}

	@Override
	public void setParameter(String key, Object value)
	{
	    if (this.params == null) {
	      this.params = new ConcurrentHashMap();
	    }
	    this.params.put(key, value);
	}
	
	public String toString()
	{
	    return "Event { Name:" + this.name + ", Source: " + this.target + ", Params: " + this.params + " }";
	}
}
